package com.bidevalution.controller.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.bidevalution.business.service.BeMethodDefineService;
import com.bidevalution.business.service.BeSectionMethodService;
import com.bidevalution.controller.vo.BeSectionMethodVO;
import com.bidevalution.dao.entity.BeMethodDefine;
import com.bidevalution.dao.entity.BeSectionMethod;
import com.qtp.core.model.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/beSectionMethod")
@Api(value = "环节页面配置")
public class BeSectionMethodController extends BaseController {
	@Autowired
	private BeSectionMethodService beSectionMethodService;

	@GetMapping("/getTemplateConfig")
	@ApiOperation(value = "查询标标段参数页面配置", notes = "查询标标段参数页面配置", response = BeSectionMethodVO.class)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "sectionId", value = "标段ID", required = true, dataType = "String", paramType = "query") })
	public Response<BeSectionMethodVO> getTemplateConfig(String sectionId) {
		BeSectionMethod beSectionMethod = beSectionMethodService.selectBySectionId(sectionId);
		if(beSectionMethod != null) {
			BeSectionMethodVO beSectionMethodVO = new BeSectionMethodVO();
			beSectionMethodVO.setMethodId(beSectionMethod.getMethodId());
			beSectionMethodVO.setMethodCode(beSectionMethod.getMethodCode());
			beSectionMethodVO.setMethodName(beSectionMethod.getMethodName());
			beSectionMethodVO.setTemplateConfig(beSectionMethod.getTemplateConfig());
			return Response.ok(beSectionMethodVO);
		}
		return Response.ok();
	}
}
